package com.xu.common.exception;

import com.xu.common.domain.MyResultCode;

/**
 * 自定义异常
 *
 * @author xu
 * 2022/7/19 16:15
 */
public class MyException extends RuntimeException{
    private Integer code;
    private String msg;

    public MyException(String msg){
        this.code = MyResultCode.BAD_REQUEST;
        this.msg=msg;
    }

    public MyException(String msg, Integer code) {
        this.msg = msg;
        this.code = code;
    }

    public MyException(String msg, Throwable e) {
        super(msg, e);
        this.msg = msg;
    }

    public String getMsg() {
        return msg;
    }

    public Integer getCode() {
        return code;
    }
}
